{% extends "exams/base_exams.html" %}

{% block content %}

<h2>Student site</h2>
<div class="welcome">Welcome {{ user.username }}</div>

<h3>Open exams<h3>

{% if exam_list %}
    <ul>
    {% for exam in exam_list %}
        <li><a href="/exams/{{ exam.id }}/">{{ exam.name }}</a></li>
    {% endfor %}
    </ul>
{% else %}
    <p>No open exams are available.</p>
{% endif %}

<h3>Exams finished<h3>

{% if takenexam_list %}
    <ul>
    {% for takenexam in takenexam_list %}
        <li><a href="/exams/{{ takenexam.id }}/result/">{{ takenexam.exam.name }}</a></li>
    {% endfor %}
    </ul>
	<div class="grade">
    <p> Average grade: {{ avg_grade|floatformat:2 }}</p>
	</div> 
{% else %}
    <p>No finished exams are available.</p>
{% endif %}

{% endblock %}

